<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html class="wrap">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>手机考勤 </title>


	<link rel="stylesheet" type="text/css" href="pc/css/cores/style.css" /><!--公共样式-->


	<link rel="stylesheet" type="text/css" href="pc/css/extends/list.css" /><!--翻页插件样式-->
	<link rel="stylesheet" type="text/css" href="pc/css/cores/alert.css" /><!--弹出盒样式-->
	<link rel="stylesheet" type="text/css" href="pc/css/cores/public.css" /><!--公共样式-->

	<%--<link rel="stylesheet" type="text/css" href="pc/css/modules/teacherClassManagement.css?f=<%=System.currentTimeMillis()%>" />--%>
	<style>
		input::-webkit-clear-button { visibility: hidden; }
		input[type=date]::-webkit-inner-spin-button { visibility: hidden; }
		.datas{
			height: 34px;
			border: 1px solid #dfdfdf;
			border-radius: 5px;
			padding-left: 12px;
			font-size: 14px;
			padding-right: 7px;
			color: #333;
			line-height: 79px;
		}
		.tableBox{
			margin-bottom: 20px;
		}
	</style>
	<script>
		function goPostDetails(id){
			var json = JSON.stringify({
				"pageName": "phone",
				"id":id
			});

			window.location.href = "skipPage?jsonStr=" + json;
		}
	</script>
</head>

<body>
<div class="crumbs">
	<div class="fl returnBox"><!-- &ensp;<img src="pc/images/ico_return.png" alt="返回按钮" />&ensp;
				<a class="looktg" href="javascript:;" onClick="javascript:window.history.go(-1)">返回上一页</a>
			 --></div>
	<div class="fl noticeBox"><img src="pc/images/ico_trumpet.png" />
		<div class="noticeBar">
			<ul>
				<li>当前暂无消息</li>
			</ul>
		</div>
	</div>
</div>
<div class="clear"></div>


<div class="mainContent">
	<div class="funBox">




		<div class="fl inputRight"><label for="curriculumNames">日期:&ensp;</label>
			<input type="date" name="user_date" class="datas"/>
		</div>
		<div class="fl inputRight"><label for="state">状&ensp;&ensp;&ensp;&ensp;态:&ensp;</label>
			<select id="state" class="publicSelect"  />
			<option value="正常">正常</option>
			<option value="缺勤">缺勤</option>
			</select>
		</div>

		<div class="fl publicBtn searchBtn">搜索</div>

		<div class="fr buttonBatch">
			手机考勤&ensp;
			<span style="margin-right:20px">
				<label><input name="Fruit" type="radio" value=true />开启 </label>
				<label><input name="Fruit" type="radio" value=false />关闭 </label>
			</span>
			<div class="fr publicBtn initAchievement">设置</div>
		</div>

		<div class="clear"></div>


	</div>
	<div class="clear"></div>
		<table class="tableBox box_1" border="0" cellspacing="0" cellpadding="0">


		</table>

<%--	<div class="page">--%>

<%--		<div class="tcdPageCode"></div>--%>

<%--	</div>--%>
	<div class="clear"></div>


</div>



<div class="clear"></div>



<script>
    var result = '${result}';
    result = JSON.parse(result);
</script>
<script src="pc/js/extends/jquery-1.11.2.min.js"></script>
<script src="pc/js/extends/bootstrap-datetimepicker.min.js"></script>
<script src="pc/js/extends/bootstrap-datetimepicker.zh-CN.js"></script>


<script src="pc/js/extends/jquery.page.js"></script><!--翻页插件-->

<script src="pc/js/cores/Alert.js"></script><!--弹出盒-->
<script src="pc/js/cores/public.js"></script><!--公共-->

<script src="pc/js/extends/trumbowyg.js"></script><!--编辑器插件-->
<script src="pc/js/extends/trumbowyg.base64.min.js"></script><!--编辑器插件-->
<script src="pc/js/modules/phone.js?f=<%=System.currentTimeMillis()%>"></script>
<script>

	switchs()
	var endTime;
	var info = [];
	var startTime;
	var switchOn;
	//点击设置
	$('.initAchievement').click(function() {
		var json = JSON.stringify({
			"pageName": "phoneSeting",
			"paramData": {
				"courseId": result.paramData.courseId,
				"classId": result.paramData.classId,

			}
		});

		window.location.href = "skipPage?jsonStr=" + json;
	})
	$('input[type=radio][name=Fruit]').change(function() {
		getval()
	})

	function getval(){
		let values = {
			"courseId":result.paramData.courseId,
			"classId" :result.paramData.classId,
			"endTime" :endTime,
			"startTime":startTime,
			"info":info,
			"switchOn":$('input[name="Fruit"]:checked').val(),

	};
		$.ajax({
			type: "post",
			url: "attendance-mobile/config/update",
			contentType:"application/json;charset=utf-8",
			async: true,
			data: JSON.stringify(values),
			success: function(data, status, xhr) {
				if(data.code == 200){


				}
			},
			error: function(data, status, xhr) {
				//loading1.hide();
				var json = JSON.stringify({
					"pageName": "error"
				});


			}
		});
	}
     //获取设置开光
     function switchs() {
		 $.ajax({
			 type: "get",
			 url: "attendance-mobile/config?classId="+result.paramData.classId+"&courseId="+result.paramData.courseId,
			 contentType:"application/json;charset=utf-8",
			 success: function(data, status, xhr) {
				 if(data.code == 200){
					  endTime = data.data.endTime;
					  info = data.data.info;
					  startTime = data.data.startTime;
					  switchOn = data.data.switchOn;

					 if(data.data.switchOn == false){
						 $('input:radio:last').attr('checked', 'checked');
					 }else{
						 $('input:radio:first').attr('checked', 'checked');
					 }
				 }
			 },
			 error: function(data, status, xhr) {
				 //loading1.hide();
				 var json = JSON.stringify({
					 "pageName": "error"
				 });


			 }
		 });
	 }

</script>
</body>

</html>